import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkAdVO, ParkAdForm, ParkAdQuery } from '@/api/park/parkAd/types';

/**
 * 查询广告列表
 * @param query
 * @returns {*}
 */

export const listParkAd = (query?: ParkAdQuery): AxiosPromise<ParkAdVO[]> => {
  return request({
    url: '/park/parkAd/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询广告详细
 * @param adId
 */
export const getParkAd = (adId: string | number): AxiosPromise<ParkAdVO> => {
  return request({
    url: '/park/parkAd/' + adId,
    method: 'get'
  });
};

/**
 * 新增广告
 * @param data
 */
export const addParkAd = (data: ParkAdForm) => {
  return request({
    url: '/park/parkAd',
    method: 'post',
    data: data
  });
};

/**
 * 修改广告
 * @param data
 */
export const updateParkAd = (data: ParkAdForm) => {
  return request({
    url: '/park/parkAd',
    method: 'put',
    data: data
  });
};

/**
 * 删除广告
 * @param adId
 */
export const delParkAd = (adId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkAd/' + adId,
    method: 'delete'
  });
};
